﻿using Microsoft.EntityFrameworkCore;
using Service.EntityFrameWork.Mapping;
using System;
using Microsoft.Extensions.Configuration;
using System.Diagnostics.CodeAnalysis;
using Centa.Agency.Application.Entity;

namespace Service.EntityFrameWork
{
    public class DemoDbContext : DbContext
    {      
       

        public DemoDbContext([NotNullAttribute] DbContextOptions options) : base(options)
        {
        }
        public DbSet<UserInfo> UserInfoDbSet { get; set; }
        //public IConfiguration Configuration { get; }
        //protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        //{
        //    optionsBuilder.UseSqlServer(Configuration.GetConnectionString("SQLServerConnection"));
        //    base.OnConfiguring(optionsBuilder);
        //}
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.ApplyConfiguration(new UserInfoEntityConfiguration());//自定义映射
            base.OnModelCreating(modelBuilder);
        }
    }
}
